/**
 * date : 2014.11
 * writer : me
 */

var count = 0;
var interval;


function init() {
	
	var f = document.frm;
	document.getElementById(f.btnStart).onclick = "btnS";
	document.getElementById(f.btnEnd).onclick = "btnE";
	
}


function btnS() {
		function run() {
			var div = document.getElementById("result");
			var now = new Date();
			var str = now.getFullYear() + "년";
			str += (now.getMonth()+1) + "월";
			str += now.getDate() + "일(";
//			str += now.week[now.getDay()] + "요일)";
			str += now.getHours() + "시";
			str += now.getMinutes() + "분";
			str += now.getSeconds() + "초)";
			
			div.innerHTML =  str ;
			
		}
	if(count == 0){
		interval = setInterval(run, 1000);
		count++;
	}
}

function btnE() {
	if(count == 1){
		clearInterval(interval);
		count--;
	}
}